﻿@using System.Collections
@using System.Web.Mvc.Html 
@using RBS.Core.Model
@{
    ViewBag.Title = "地图模式";
}   
  <style type="text/css">
 
	#iCenter{width:100%;height:400px;border:1px solid #F6F6F6;margin:10px 0 0;}
	h1,p{line-height:1.5em;}
	span{float:right;}
</style>
    <h1>菜系</h1>
    <strong>
       
            @{
                var dictinfoList = new RBS.Core.BLL.SYS_DictInfo().GetModelList("ParentID=1");
                 dictinfoList.Sort((x, y) => x.Sequence.CompareTo(y.Sequence)); 

                 foreach (var dictinfo in dictinfoList)
                {
                    <input type="radio" name="Cuisine" value="@dictinfo.DictName" onclick="getType('@dictinfo.DictName')"/> @dictinfo.DictName
                }
            } 
      
    </strong>
	<div id="iCenter"></div>   
 
<script language="javascript">  
var mapObj;  
var keywords;
var cloudDataLayer;
window.onload=mapInit();
/* 
 *初始化地图对象，加载地图 
 */  
function mapInit(){  
    mapObj = new AMap.Map("iCenter");      
    addCloudLayer();   
}  
/* 
 *叠加云数据图层 
 */  
function addCloudLayer() {  
    //加载云图层插件  
    mapObj.plugin('AMap.CloudDataLayer', function () {  
        var layerOptions = {   
            query:{keywords: ''},   
            clickable:true  
        };  
        cloudDataLayer = new AMap.CloudDataLayer('547c0137e4b068ad0ea565e1', layerOptions); //实例化云图层类  
        cloudDataLayer.setMap(mapObj); //叠加云图层到地图  
        AMap.event.addListener(cloudDataLayer, 'click', function (result) {  
            var clouddata = result.data;  
            var infoWindow = new AMap.InfoWindow({  
                content:"<h3><font face=\"微软雅黑\"color=\"#3366FF\">"+ clouddata._name +"</font></h3><hr />地址："+ clouddata._address + "<br />" + "电话号码：" + clouddata.Telphone+ "<br />" + "菜系：" +clouddata.Cuisine+  "</strong><br />" + "所在省份：" +clouddata.provinces ,  
                size:new AMap.Size(300, 0),  
                autoMove:true,  
                offset:new AMap.Pixel(0,-5)  
            });   
            infoWindow.open(mapObj, clouddata._location);  
        });  
    });  
}   
function getType(Cuisine) {
    var op = {
        query: { keywords: Cuisine }
    };
    cloudDataLayer.setOptions(op);
}
</script>  

